#include "widget.h"
#include "ui_widget.h"


Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);


    connect(ui->Exit,&QPushButton::clicked,[this](){
       this->close();
    });
    connect(&w_classic,&Classic::ret,[this](){
        this->show();
        w_classic.close();

    });
    connect(&w_pass,&pass::ret , [this](){
        this->show();
        w_pass.hide();

    });
    connect(&w_combat,&Combat::ret,[this](){
        this->show();
        w_combat.hide();

    });
     ui->label->adjustSize();


}

Widget::~Widget()
{
    delete ui;
}
//跳转到经典模式
void Widget::on_Classic_clicked()
{
    if(w_classic.getIsHide()){
        w_classic.getTimer()->start();
    }
    w_classic.show();
    this->hide();

}
void Widget::paintEvent(QPaintEvent *)
{
    QPainter painter(this);
    QPixmap pixmap;
    pixmap.load(":/rec/Maze.jpg");
    painter.drawPixmap(0, 0, this->width(), this->height(),pixmap);
}


void Widget::on_combat_clicked()
{
    w_combat.show();
    this->hide();
}
//闯关模式
void Widget::on_pushButton_2_clicked()
{   if(w_pass.isret){
       w_pass.isret=false;

    }
    w_pass.show();
    this->hide();
}
